private _list = as_start_pos nearRoads 50000;
private _num = (count _list) / 1000;


if(Param_Debug == 1) then
{
	systemChat format["路点共计：%1", _num];
};

//路点S
for "_i" from 1 to _num do
{
	sleep 0.1;
	
	//寻找空闲道路
	private _time = time + 30;
	private _failed = false;
	private _road = selectRandom _list;
	private _pos = getPos _road;
	
	while{!([_pos, 0] call fn_checkPos) 
	|| {[_pos, 800 * as_near_scale, "mk_"] call fn_checkNearMarker}
	|| {_pos distance2D as_start_pos < 600 * as_near_scale}}do
	{
		_road = selectRandom _list;
		_pos = getPos _road;
		if(time > _time) exitWith{_failed = true};
	};
	//创建标记
	if(!_failed) then
	{
		as_marker_count = as_marker_count + 1;
		_marker = createMarker [format["mk_es_%1", as_marker_count], _pos];
		
		private _dir = random 360;
		//设置标记
		if(Param_ShowMarker > 1) then
		{
			_marker setMarkerShape "ICON";
			_marker setMarkerColor "ColorYellow";
			_marker setMarkerType "mil_box";
			_marker setMarkerSize [0.5, 0.5];
		};
		
		//创建点
		[_marker, _dir] call (selectRandom as_all_es);
	};
	
	
	
	
};
